<style type="text/css">
	form.client input[type="text"]{
		width: 300px;
	}
	form.client label{
		width: 70px;
	}
	form.client .row.button{
		padding-left: 110px;
	}
</style>

<ul class="btn">
	<li><a href="javascript:void(0);" class="add">Add</a></li>
</ul>

<table class="records">
	<caption>
		<span>Title</span>
	</caption>
	<thead>
		<tr>
			<th width="13"><input type="checkbox" name="select" value="0"/></th>
			<th width="50"><a href="javascript:void(0);" data-field="0">type</a></th>
			<th width="120"><a href="javascript:void(0);" data-field="5">server</a></th>
			<th width="150"><a href="javascript:void(0);" data-field="1">name</a></th>
			<th width="25"><a href="javascript:void(0);" data-field="2">api</a></th>
			<th width="25"><a href="javascript:void(0);" data-field="3">sid</a></th>
			<th width="30"><a href="javascript:void(0);" data-field="4">unid</a></th>
			<th width="200">verify</th>
			<th width="30">sigKey</th>
			<th>url</th>
			<th width="30"><a href="javascript:void(0);" data-field="6">flag</a></th>
			<th width="50">action</th>
		</tr>
	</thead>
	<tfoot><tr><td colspan="12"></td></tr></tfoot>
	<tbody><tr><td colspan="12"></td></tr></tbody>
</table>
<!-- .replace(/android|iphone|WinPhone|mac|ipad|html5/gi, ''); -->
<script type="text/x-tmpl" class="list-tmpl">
	<% for(var i=0,l=records.length;i<l;i++) { %>
		<% 
			var name = records[i]['name'];
			var type = records[i]['type'] - 1;
			var types = ['Iphone', 'Ipad', 'Android', 'HTML5', 'WinPhone', 'Mac'];
		%>
		<tr>
			<td><input type="checkbox" name="id[]" value="<%=records[i]['id']%>"/></td>
			<td><%=types[type]%></td>
			<td><%=records[i]['serverName']%></td>
			<td title="<%=records[i]['name']%>"><%=name.length > 15 ? name.substring(0, 15) + '...' : name %></td>
			<td><%=records[i]['api']%></td>
			<td><%=records[i]['sid']%></td>
			<td><%=records[i]['unid']%></td>
			<td><%=records[i]['verify']%></td>
			<td><%=records[i]['sig']%></td>
			<td><%=records[i]['url']%></td>
			<td><%=(records[i]['flag'] > 0 ? 'ok' : 'err')%></td>
			<td><a href="javascript:void(0);" class="btn edit">Edit</a>
		</tr>
	<% } %>
</script>

<script type="text/x-tmpl" class="form-tmpl">
	<form action="php/index.php?controller=client&action=set" method="post" class="client">
		<input type="hidden" name="id"/>
		<div class="row">
			<label>type</label>
			<select name="type">
				<option value="1">Iphone</option>
				<option value="2">Ipad</option>
				<option value="3">Android</option>
				<option value="4">HTML5</option>
				<option value="5">WinPhone</option>
				<option value="6">Mac</option>
			</select>
		</div>
		<div class="row">
			<label>server</label>
			<select name="server">
				<% var i, l = records.length; %>
				<% for(i = 0;i < l;i += 1) {%>
				<option value="<%=records[i]['id']%>"><%=records[i]['name']%></option>
				<% } %>
			</select>
		</div>
		<div class="row"><label>api</label><input type="text" name="api"/></div>
		<div class="row"><label>name</label><input type="text" name="name"/></div>
		<div class="row"><label>sid</label><input type="text" name="sid"/></div>
		<div class="row"><label>unid</label><input type="text" name="unid"/></div>
		<div class="row"><label>verify</label><input type="text" name="verify"/></div>
		<div class="row"><label>letter</label><input type="text" name="sig"/></div>
		<div class="row"><label>url</label><input type="text" name="url"/></div>
		<div class="row"><label>appId</label><input type="text" name="appId"/></div>
		<div class="row"><label>appKey</label><input type="text" name="appKey"/></div>
		<div class="row"><label>flag</label><input type="text" name="flag"/></div>
		<div class="row button"><input type="submit" name="submit" value="提交"/></div>
	</form>
</script>